package com.it135.citytraffic.mapper;

import com.it135.citytraffic.pojo.entity.RoadTimeStatistic;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;


@Mapper
public interface RoadTimeStatisticMapper extends BaseMapper<RoadTimeStatistic> {

    @Select("select time,count from road_time_statistic where road_statistic_id = #{id}")
    List<RoadTimeStatistic> getRTS(Long id);

    @Select("select sum(rts.count) from road_time_statistic rts, road_statistic rs where " +
            "rs.id = #{id} and rts.road_statistic_id = rs.id")
    int getAll(Long rsId);
}
